// source --> http://robert-hacker.de/wp-content/plugins/photo-gallery/booster/assets/js/global.js?ver=1.0.0 jQuery(function () { /* Change the CTA for pages with PG in it.*/ if (jQuery(".bwg-container").length) { var html = '
'; html += ''; html += ''; html += '
'; jQuery(".twb_admin_bar_menu").html(html).on("click", function () { window.open(twb.href, '_blank'); }); jQuery(".twb_admin_bar_menu_main").remove(); } /* Is score check in progress.*/ twb_inprogress = false; /* Check if any score check is in progress.*/ jQuery(".twb-notoptimized").each(function () { if (jQuery(this).data("status") == 'inprogress') { /* Disable score check button.*/ twb_disable_check(); } }); /* Add check score action to the button in page/posts list, if there is no inprogress action.*/ jQuery(".twb-notoptimized .twb_check_score_button").on("click", function () { if (!twb_inprogress) { twb_check_score(this); } }); /* Add a hover action to show dismiss tooltip.*/ jQuery("th[id^='twb-speed-']").hover(function () { jQuery(this).find(".twb-dismiss-container").removeClass("twb-hidden"); }, function () { jQuery(this).find(".twb-dismiss-container").addClass("twb-hidden"); }); /* Add a hover action to show page score.*/ jQuery(".twb-see-score").hover(function () { jQuery(this).parent().parent().find(".twb-score-container").removeClass("twb-hidden"); }, function () { jQuery(this).parent().parent().find(".twb-score-container").addClass("twb-hidden"); }); jQuery(".twb-score-container:not(.twb_admin_bar_menu_content .twb-score-container), .twb-score-disabled-container").hover(function () { jQuery(this).removeClass("twb-hidden"); }, function () { jQuery(this).addClass("twb-hidden"); }); /* Draw circle on given scores.*/ jQuery(".twb-score-circle").each(function () { twb_draw_score_circle(this); }); /* Show/hide Image optimizer menu content container */ jQuery("#wp-admin-bar-twb_adminbar_info").mouseenter(function(){ jQuery(".twb_admin_bar_menu_main .twb-score-container").removeClass("twb-hidden"); jQuery(".twb_admin_bar_menu_main").removeClass("twb-hidden"); }).mouseleave(function() { jQuery(".twb_admin_bar_menu_main").addClass("twb-hidden"); }); /* Draw circle on given scores.*/ jQuery('.twb-score-circle').each(function () { twb_draw_score_circle(this); }); if( jQuery(".twb_admin_bar_menu.twb_backend span").hasClass("twb_backend_optimizing_logo") ) { /* Run ajax every 30 seconds to check if score counted */ twb_run_notif_check = setInterval( twb_run_notif_check, 30000 ); } }); /* Run ajax to check score counting status and show notification */ function twb_run_notif_check() { jQuery.ajax({ type: "POST", url: twb.ajax_url, data: { action: "twb_notif_check", twb_nonce: twb.nonce, } }).success(function (results) { var result = jQuery.parseJSON(results); if (result.html != "") { /* Show notification popup and change menu icon and text from loading to Not optimised */ if ( result.changeLogo == 1 ) { jQuery(".twb_admin_bar_menu_header span").addClass("twb_counted"); } jQuery("#wp-admin-bar-twb_adminbar_info").append(result.html); jQuery(".twb_admin_bar_menu_content .twb-score-container").removeClass("twb-hidden"); jQuery(".twb_admin_bar_menu_content .twb-score-container .twb-score-circle").each(function () { twb_draw_score_circle(this); }); clearInterval(twb_run_notif_check); } }).error(function () { clearInterval(twb_run_notif_check); }); } function twb_disable_check() { twb_inprogress = true; /* Add a hover action to show disabled notification.*/ jQuery(".twb-notoptimized").hover(function () { jQuery(this).parent().find(".twb-score-disabled-container").removeClass("twb-hidden"); }, function () { jQuery(this).parent().find(".twb-score-disabled-container").addClass("twb-hidden"); }); } /** * Optimize the page. * @param that */ function twb_check_score(that) { var post_id = jQuery(that).data("post_id"); var parent = jQuery(that).parent().parent().parent(); //var parent = jQuery(that).closest(".twb-score-container").parent(); /* Class add loading near admin bar menu */ jQuery(".twb_admin_bar_menu.twb_frontend").addClass("twb_score_inprogress"); /* If the action is not called with reload button.*/ if (parent.find(".twb-optimized").hasClass("twb-hidden")) { /* Do not show loading in list.*/ parent.find(".twb-optimizing").removeClass("twb-hidden"); } else { /* Show loading on reload buttons.*/ parent.find(".twb-score-overlay").removeClass("twb-hidden"); parent.find(".twb-score-overlay div").removeClass("twb-reload").addClass("twb-loader"); } parent.find(".twb-notoptimized").addClass("twb-hidden"); /* In case of Elementor */ if( parent.hasClass("twb_elementor_settings_content") ) { jQuery(".twb_elementor_control_title").text(twb.checking).removeClass("twb_not_optimized").prepend(""); } /* Disable score check button.*/ twb_disable_check(); jQuery.ajax({ url: twb.ajax_url, type: "POST", dataType: 'json', data: { action: "twb_check_score", post_id: post_id, twb_nonce: twb.nonce }, success: function (data) { if (data.error) { /* Show reload buttons on failure.*/ parent.find(".twb-score-overlay").removeClass("twb-hidden"); parent.find(".twb-score-overlay div").removeClass("twb-loader").addClass("twb-reload"); } else { parent.find(".twb-score-overlay").addClass("twb-hidden"); var desktop = parent.find(".twb-score-desktop").find(".twb-score-circle"); desktop.data( { "score": data.desktop_score, "tti": data.desktop_tti, }); twb_draw_score_circle(desktop); var mobile = parent.find(".twb-score-mobile").find(".twb-score-circle"); mobile.data( { "score": data.mobile_score, "tti": data.mobile_tti, }); twb_draw_score_circle(mobile); } }, error: function (xhr, textStatus, errorThrown) { /* Show reload buttons on failure.*/ parent.find(".twb-score-overlay").removeClass("twb-hidden"); parent.find(".twb-score-overlay div").removeClass("twb-loader").addClass("twb-reload"); }, complete: function (xhr, textStatus) { /* Hide optimizing container, show See score container.*/ parent.find(".twb-optimizing").addClass("twb-hidden"); parent.find(".twb-optimized").removeClass("twb-hidden"); jQuery("#wpadminbar .twb-optimized .twb-score-container").removeClass("twb-hidden"); jQuery("#wpadminbar .twb_admin_bar_menu").removeClass("twb_score_inprogress"); jQuery("#wpadminbar .twb_menu_logo").remove(); jQuery("#wpadminbar .twb_not_optimized_logo").removeClass("twb-hidden"); jQuery("#wpadminbar .twb_admin_bar_menu_header").addClass("twb_not_optimized"); /* Remove disabled action.*/ twb_inprogress = false; jQuery(".twb-notoptimized").hover(function () { jQuery(this).parent().find(".twb-score-disabled-container").addClass("twb-hidden"); }); /* In case of Elementor */ if( parent.hasClass("twb_elementor_settings_content") ) { jQuery(".twb_elementor_control_title").text(twb.notoptimized).remove("span.twb_inprogress").addClass("twb_not_optimized"); } } }); } /** * Draw circle on given score. * @param that */ function twb_draw_score_circle(that) { var score = parseInt(jQuery(that).data('score')); var size = parseInt(jQuery(that).data('size')); var thickness = parseInt(jQuery(that).data('thickness')); var color = score <= 49 ? "rgb(253, 60, 49)" : (score >= 90 ? "rgb(12, 206, 107)" : "rgb(255, 164, 0)"); jQuery(that).parent().find('.twb-load-time').html(jQuery(that).data('tti')); var _this = that; jQuery(_this).circleProgress({ value: score / 100, size: size, startAngle: -Math.PI / 4 * 2, lineCap: 'round', emptyFill: "rgba(255, 255, 255, 0)", thickness: thickness, fill: { color: color } }).on('circle-animation-progress', function (event, progress) { var content = ''; if (score != 0) { content = Math.round(score * progress); } jQuery(that).find('.twb-score-circle-animated').html(content).css({"color": color}); jQuery(that).find('canvas').html(Math.round(score * progress)); }); } /* Adding button in Elementor edit panel navigation view */ function twb_add_elementor_button() { window.elementor.modules.layouts.panel.pages.menu.Menu.addItem({ name: twb.title, icon: "twb-element-menu-icon", title: twb.title, type: "page", callback: () => { try { window.$e.route("panel/page-settings/twb_optimize") } catch (e) { window.$e.route("panel/page-settings/settings"), window.$e.route("panel/page-settings/twb_optimize") } } }, "more") } jQuery(window).on("elementor:init", () => { window.elementor.on("panel:init", () => { setTimeout(twb_add_elementor_button) }) }); // source --> http://robert-hacker.de/wp-content/plugins/google-analytics-for-wordpress/assets/js/frontend-gtag.min.js?ver=8.14.1 ;var MonsterInsights=function(){var e=[],i='',r=!1;this.setLastClicked=function(t,n,i){t=typeof t!=='undefined'?t:[];n=typeof n!=='undefined'?n:[];i=typeof i!=='undefined'?i:!1;e.valuesArray=t;e.fieldsArray=n};this.getLastClicked=function(){return e};this.setInternalAsOutboundCategory=function(e){i=e};this.getInternalAsOutboundCategory=function(){return i};this.sendEvent=function(e,t,n){x(e,t,n,[])};function d(){if(window.monsterinsights_debug_mode){return!0} else{return!1}};function c(e,t,n){var l={};for(var i in e){if(!e.hasOwnProperty(i)){continue};if(t&&t.indexOf(i)===-1){continue};if(n&&n.indexOf(i)>-1){continue};l[i]=e[i]};return l};function b(e,t,n){if(!monsterinsights_frontend.v4_id||e!=='event'){return};var i=n.event_category||'',a=['event_name','event_category','event_label','value',],l=c(n,null,a);l.action=t;l.send_to=monsterinsights_frontend.v4_id;let hitType=i.replace('-','_');if(i.indexOf('outbound-link')!==-1){hitType='click'} else if(i==='download'){hitType='file_download'};__gtagTracker(e,hitType,l)};function y(e,t,n){if(!monsterinsights_frontend.ua){return};var l=['event_category','event_label','value',],i=c(n,l);i.send_to=monsterinsights_frontend.ua;__gtagTracker(e,t,i)};function l(t,i,l,a){t=typeof t!=='undefined'?t:'event';i=typeof i!=='undefined'?i:'';a=typeof a!=='undefined'?a:[];l=typeof l!=='undefined'?l:{};y(t,i,l);b(t,i,l);e.valuesArray=a;e.fieldsArray=l;e.fieldsArray.event_action=i;e.tracked=!0;n('Tracked: '+a.type);n(e)};function x(t,i,l,a){t=typeof t!=='undefined'?t:'event';i=typeof i!=='undefined'?i:'';a=typeof a!=='undefined'?a:[];l=typeof l!=='undefined'?l:{};__gtagTracker(t,i,l);e.valuesArray=a;e.fieldsArray=l;e.fieldsArray.event_action=i;e.tracked=!0;n('Tracked: '+a.type);n(e)};function t(t){t=typeof t!=='undefined'?t:[];e.valuesArray=t;e.fieldsArray=[];e.tracked=!1;n('Not Tracked: '+t.exit);n(e)};function n(e){if(d()){console.dir(e)}};function o(e){return e.replace(/^\s+|\s+$/gm,'')};function u(){var n=0,e=document.domain,i=e.split('.'),t='_gd'+(new Date()).getTime();while(n<(i.length-1)&&document.cookie.indexOf(t+'='+t)==-1){e=i.slice(-1-(++n)).join('.');document.cookie=t+'='+t+';domain='+e+';'};document.cookie=t+'=;expires=Thu, 01 Jan 1970 00:00:01 GMT;domain='+e+';';return e};function h(e){e=e.toString();e=e.substring(0,(e.indexOf('#')==-1)?e.length:e.indexOf('#'));e=e.substring(0,(e.indexOf('?')==-1)?e.length:e.indexOf('?'));e=e.substring(e.lastIndexOf('/')+1,e.length);if(e.length>0&&e.indexOf('.')!==-1){e=e.substring(e.lastIndexOf('.')+1);return e} else{return''}};function w(e){return e.which==1||e.which==2||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey};function g(){var e=[];if(typeof monsterinsights_frontend.download_extensions=='string'){e=monsterinsights_frontend.download_extensions.split(',')};return e};function m(){var e=[];if(typeof monsterinsights_frontend.inbound_paths=='string'){e=JSON.parse(monsterinsights_frontend.inbound_paths)};return e};function T(e){if(e.which==1){return'event.which=1'} else if(e.which==2){return'event.which=2'} else if(e.metaKey){return'metaKey'} else if(e.ctrlKey){return'ctrlKey'} else if(e.shiftKey){return'shiftKey'} else if(e.altKey){return'altKey'} else{return''}};function A(e){var f=g(),l=m(),t='unknown',d=e.href,v=h(e.href),c=u(),r=e.hostname,a=e.protocol,k=e.pathname;d=d.toString();var s,p,b=e.getAttribute('data-vars-ga-category');if(b){return b};if(d.match(/^javascript\:/i)){t='internal'} else if(a&&a.length>0&&(o(a)=='tel'||o(a)=='tel:')){t='tel'} else if(a&&a.length>0&&(o(a)=='mailto'||o(a)=='mailto:')){t='mailto'} else if(r&&c&&r.length>0&&c.length>0&&!r.endsWith('.'+c)&&r!==c){t='external'} else if(k&&JSON.stringify(l)!='{}'&&k.length>0){var y=l.length;for(var n=0;n0&&l[n].label.length>0&&k.startsWith(l[n].path)){t='internal-as-outbound';i='outbound-link-'+l[n].label;break}}} else if(r&&window.monsterinsights_experimental_mode&&r.length>0&&document.domain.length>0&&r!==document.domain){t='cross-hostname'};if(v&&(t==='unknown'||'external'===t)&&f.length>0&&v.length>0){for(s=0,p=f.length;s0&&(d.endsWith(f[s])||f[s]==v)){t='download';break}}};if(t==='unknown'){t='internal'};return t};function O(e,t){var n=(e.target&&!e.target.match(/^_(self|parent|top)$/i))?e.target:!1;if(t.ctrlKey||t.shiftKey||t.metaKey||t.which==2){n='_blank'};return n};function v(e){if(e.getAttribute('data-vars-ga-label')&&e.getAttribute('data-vars-ga-label').replace(/\n/ig,'')){return e.getAttribute('data-vars-ga-label').replace(/\n/ig,'')} else if(e.title&&e.title.replace(/\n/ig,'')){return e.title.replace(/\n/ig,'')} else if(e.innerText&&e.innerText.replace(/\n/ig,'')){return e.innerText.replace(/\n/ig,'')} else if(e.getAttribute('aria-label')&&e.getAttribute('aria-label').replace(/\n/ig,'')){return e.getAttribute('aria-label').replace(/\n/ig,'')} else if(e.alt&&e.alt.replace(/\n/ig,'')){return e.alt.replace(/\n/ig,'')} else if(e.textContent&&e.textContent.replace(/\n/ig,'')){return e.textContent.replace(/\n/ig,'')} else{return undefined}};function K(e){var i=e.children,l=0,a,n;for(var t=0;t>>0;if(i===0){return-1};t=i-1;if(arguments.length>1){t=Number(arguments[1]);if(t!=t){t=0} else if(t!=0&&t!=(1/0)&&t!=-(1/0)){t=(t>0||-1)*Math.floor(Math.abs(t))}};for(n=t>=0?Math.min(t,i-1):i-Math.abs(t);n>=0;n--){if(n in l&&l[n]===e){return n}};return-1}}},MonsterInsightsObject=new MonsterInsights();